package com.yc.mvc.web.bean;

import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;
import java.util.List;

@Data
public class User {

    @NotNull(message = "账号不能为空!")
    @NotBlank(message = "账号长度必须大于0")
    @Length(min = 2, max = 16 , message = "账号必须是2~16个字符")
    private String name;
    @NotNull(message = "密码不能为空!")
    @Length(min = 6, max = 12 , message = "密码必须是6~12个字符")
    private String pwd;
    @NotNull(message = "年龄不能为空!")
    @Max(value = 80, message = "最大年龄不能超过80岁")
    @Min(value = 8)
    private int age;
    @Email
    private String email;
    @Pattern(regexp="[男女]")
    private String gender;
    @Size(min = 2, message = "至少选择2项爱好!")
    private List<String> likes;
    private User father;
    private User mather;
    private User[] friends;

}
